package com.margo.project.web.mvcconfig.formatterRegistry;

import java.util.HashSet;
import java.util.Set;

import org.springframework.format.AnnotationFormatterFactory;
import org.springframework.format.Parser;
import org.springframework.format.Printer;

public class MargoStringFormatAnnotationFormatterFactory implements AnnotationFormatterFactory<StringConverterFormat>{

	 private final Set<Class<?>> fieldTypes;  
	 private final StringConverterFormatter formatter;  

    public MargoStringFormatAnnotationFormatterFactory() {
        Set<Class<?>> set = new HashSet<Class<?>>();  
        set.add(String.class);  
        this.fieldTypes = set;  
        this.formatter = new StringConverterFormatter();
    }
	
	@Override
	public Set<Class<?>> getFieldTypes() {
		// TODO Auto-generated method stub
		return fieldTypes;
	}

	@Override
	public Printer<?> getPrinter(StringConverterFormat annotation, Class<?> fieldType) {
		// TODO Auto-generated method stub
		return formatter;
	}

	@Override
	public Parser<?> getParser(StringConverterFormat annotation, Class<?> fieldType) {
		// TODO Auto-generated method stub
		return formatter;
	}

}
